package checker

import (
	"kumachan/interpreter/lang/common/name"
	"kumachan/interpreter/lang/common/source"
)

func makeVdTypeRecordDefaults(tim VdTypeInfoMapping) (VdTypeRecordDefaults, source.Errors) {
	var defaults = make(VdTypeRecordDefaults)
	for def, info := range tim {
		var record, is_record = getBoxedRecord(def)
		if is_record {
			var this_defaults = make(map[uint] name.FunctionName)
			for i, field := range record.Fields {
				var index = uint(i)
				var n = field.Attr.Default
				if n != (name.FunctionName {}) {
					this_defaults[index] = n
				}
			}
			if len(this_defaults) > 0 {
				defaults[info.Id] = this_defaults
			}
		}
	}
	return defaults, nil
}


